//
//  WHYNewsDetail.m
//  News163
//
//  Created by 王洪运 on 16/1/3.
//  Copyright © 2016年 王洪运. All rights reserved.
//

#import "WHYNewsDetail.h"
#import "WHYNewsDetailImage.h"


@implementation WHYNewsDetail

-(instancetype)initWithDict:(NSDictionary *)dict {
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
        
        NSArray *dictArr = self.img;
        NSMutableArray *modelArr = [NSMutableArray array];
        for (NSDictionary *modelDict in dictArr) {
            WHYNewsDetailImage *newsDetaileImage = [WHYNewsDetailImage newsDetailImageWithDict:modelDict];
            [modelArr addObject:newsDetaileImage];
        }
        self.img = modelArr;
    }
    return self;
}

+(instancetype)newsDetailWithDict:(NSDictionary *)dict {
    return [[self alloc] initWithDict:dict];
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key {}

-(NSString *)description {
    NSString *desc = [NSString stringWithFormat:@"\ntitle : %@\nptime : %@\nbody : %@\nimg : %@",self.title, self.ptime, self.body, self.img];
    return desc;
}


@end
